###readme.txt

This folder contains the all Tables and Figures in original analysis included
in Chapter 2 of:
    Enos, Ryan D. 2017. The Space Between Us:
        Social Geography and Politics

Updated: October 25, 2017

***To replicate these files*** run "Chapter2Master.r" by typing
"source('Chapter2Master.r')" into the R terminal. This will use pre-processed
data to output tables and figures in the book and appendix. It does so by calling
the subordinate files: "TablesA1A2Figure2_1.r","TablesA3A4.r",
"TablesA5A6.r", "TablesA7A8.r", "TablesA9A10.r", "'TablesA11A12.r", and
"TableA13.r".

**Prior to executing the scripts, the R terminal should be pointed to the
directory in which the replication files are located, which can be accomplished
by typing "setwd('..')" where ".." is the local file structure where the replication
files are located.

These files require the R programming language, which can be downloaded here: http://www.r-project.org/

You execute replication_master.r, you may need to install the packages used,
this can be accomplished by typing the following in the R terminal:
install.packages('apsrtable'); install.packages('ggplot2');
install.packages('stargazer'); install.packages('data.table');
install.packages('AER')

Questions? Please contact Ryan Enos (renos@gov.harvard.edu).

************************************************************** ***

There is one .csv files associated with each of these scripts. Descriptions the csv
and variables included are below:

***TablesA1A2Figure2_1_data.csv***

creates output for Tables A1 and A2 in the Appendix and Figure 2.1 in the
book.

Variables:

"dma_NAME": name of the Designated Market Area

"diss": Black/white dissimilarity measured at DMA level in 2010

"raciallychargedsearch": racially charged Google searches at DMA level

"south": is the primary location of the DMA in the South according to
Census region designations

"pct.black": proportion Black of the total Black and white population in the
DMA in 2010

"total.pop": DMA total population in 2010

"average.income": DMA mean household income in 2010

"pct.college": percent of total population with a Bachelor's degree or higher

###################

***TablesA3A4_data.csv***

creates output for Tables A3 and A4 in the Appendix.

Variables:

"stereotypes": stereotype about Blacks on 1-7 scale where lower numbers
are more negative, taken from mean of "hard working" (SCAP718B in
Cooperative Campaign Analysis Project (CCAP)) and "intelligent"
(SCAP719B in CCAP).

"dissimilarity": Black/white dissimilarity measured at CBSA level in 2010

"percent.black": proportion Black of the total Black and white population in the
CBSA in 2010

"income.recode": individual income from the CCAP

"college.educated": bachelor's degree or higher from CCAP

"cbsa_NAMELSAD10": name of CBSA

"south": state of residence from CCAP is in South according to Census
region designations

 "PROFILE66": state of residence from CCAP


###################

***TablesA5A6_data.csv***

creates output for Tables A5 and A6 in the Appendix.

Variables:

"stereotypes": stereotype about Blacks on 1-7 scale where lower numbers are
more negative, taken from mean of "hard working" (SCAP718B in Cooperative
Campaign Analysis Project (CCAP)) and "intelligent" (SCAP719B in CCAP).

"dissimilarity": Black/white dissimilarity measured at CBSA level in 2010

"percent.black": proportion Black of the total Black and white population in the
CBSA in 2010

"income.recode": individual income from the CCAP

"college.educated": bachelor's degree or higher from CCAP

"cbsa_NAMELSAD10": name of CBSA

"south": state of residence from CCAP is in South according to Census region
designations

 "PROFILE66": state of residence from CCAP


###################

***TablesA7A8_data.csv***

creates output for Tables A7 and A8 in the Appendix.

Variables:

"white.obama.vote": estimated percent of white voters in precinct voting for
Obama

"dissimilarity": Black/white dissimilarity measured at CBSA level in 2010

"cbsa.percent.black":proportion Black of the total Black and white population in
the CBSA in 2010

"pct.black": percent Black in the precinct, taken from 2010 Census Block
Groups

"kerry.pct.04": percent of voters in precinct voting for Kerry in 2004 (of all
votes cast)

 "hhi_white_nonhisp": median white household income from 2010 Census

"Precinct.State": state in which precinct is located

"south": state is in South according to Census region designations

"total_population": total population of precinct


###################

***TablesA9A10_data.csv***

creates output for Tables A9 and A10 in the Appendix.

Variables:

"obama.vote": self-reported vote for Obama

"percent.black": proportion Black of the total Black and white population in the
CBSA in 2010

"dissimilarity": Black/white dissimilarity measured at CBSA level in 2010

"cbsa_NAMELSAD10": name of CBSA

"income.recode": individual income from the CCAP

"college.educated": bachelor's degree or higher from CCAP

"south": state of residence from CCAP is in South according to Census region
designations

###################

***TablesA11A12_data.csv***

creates output for Tables A11 and A12 in the Appendix.

The script calls three separate data files: TablesA11A12white_dat.csv,
'TablesA11A12black_dat.csv, and 'TablesA11A12hispanic_dat.csv which are
white, Black, and Hispanic voters in the United States in 2012 as listed in the
Catalist voterfile. These data are not individuals but are counts and proportions
of unique demographic groups by DMA. The count variable is the number of
voters in the cell and is used to weight the regressions.

Variables:

"voted2012": proportion Catalist data cell voting in 2012

"diss": white/non-white, Black/non-Black, and Hispanic/non-Hispanic
Dissimilarity in the three respective datasets

"nonwhite.to.white", "nonblack.to.black", "nonhispanic.to.hispanic" are
proportion of the outgroup of the total ougroup and ingroup population in the
DMA in each dataset, respectively.

"gender": gender of people in the cells

"familyincome" average family income in the cell

"partyaffiliation" party affiliation in the cell

"state" state of all voters in the cell

"dma_ID" indicator for Designated Market Area

"count" count of persons in the cell

"south": Is state in South according to Census region designations


###################

***TableA13_data.csv***

creates output for Table A13in the Appendix.

Variables:

"white.obama.vote": estimated percent of white voters in precinct voting for
Obama

"dissimilarity": Black/white dissimilarity measured at CBSA level in 2010

"cbsa.percent.black": proportion Black of the total Black and white population
in the CBSA in 2010

"pct.black": percent Black in the precinct, taken from 2010 Census Block
Groups

"kerry.pct.04": percent of voters in precinct voting for Kerry in 2004 (of all
votes cast)

 "hhi_white_nonhisp": median white household income from 2010 Census

"Precinct.State": state in which precinct is located

"total_population": total population of precinct

"lenper": railroad length, as reported by Ananat (2011)
